package com.ygo.feihua.view;

import android.content.*;
import android.widget.*;
import android.graphics.*;
import android.util.*;
import android.text.*;
import android.view.*;
public class HangEditText extends EditText
{
	private Paint line;
	public HangEditText(Context context,AttributeSet As){
		super(context,As);
		setFocusable(true);
		line=new Paint();
		line.setColor(Color.parseColor("#008cf9"));
		line.setStrokeWidth(4);
		setPadding(95,0,0,0);
		setGravity(Gravity.TOP);
	}
	@Override
	protected void onDraw(final Canvas canvas)
	{
// TODO: Implement this metho
		if(getText().toString().length()!=0){
			float y=0;
			Paint p=new Paint();
			//数字颜色为灰色
			p.setColor(Color.GRAY);
			p.setTextSize(35);
			for(int l=0;l<getLineCount();l++){
				y=((l+1)*getLineHeight())-(getLineHeight()/4);
				canvas.drawText(String.valueOf(l+1),0,y,p);
				canvas.save();
			}
		}
		int k=getLineHeight();
		int i=getLineCount();
		canvas.drawLine(90,0,90,getHeight()+(i*k),line);
		int y=(getLayout().getLineForOffset(getSelectionStart())+1)*k;
		canvas.drawLine(0,y,getWidth(),y,line);
		canvas.save();
		canvas.restore();
		super.onDraw(canvas);
	}
}
